package cn.mianshiyi.monitor;


/**
 * @author shangqing.liu
 */
public class Monitor {

    /**
     * 计算平均时间
     * @param name 监控名称
     * @param time 一次耗时
     */
    public static void record(String name, long time) {
        MonitorKernel.monitorTime(makeName(name) + MonitorConts.TIME_SUFFIX, time);
    }

    /**
     * 计数器
     * @param name 监控名称
     */
    public static void record(String name) {
        MonitorKernel.monitorCount(makeName(name) + MonitorConts.COUNT_SUFFIX);
    }

    private static String makeName(String name) {
        return name.replaceAll(" ", MonitorConts.XH_LINE);
    }

}
